<?php
namespace api\helpers;

use Yii;
use yii\base\Component;
use yii\web\ServerErrorHttpException;

/**
 * JWT 生成工具
 */
class Util extends Component
{

    /**
     * 获取token.
     * @param mixed $model 一个数据模型.
     * @return string 返回生成好的token.
     */
    public static function error($data, $statusCode)
    {
        Yii::$app->response->statusCode = $statusCode;
        throw new ServerErrorHttpException($data);
    }

}
